package quorum;
import broadcast.Broadcast;

public class ImAlive implements Runnable{
	public static final int SEND_INTERVAL = timer.aliveTime + 10000;
	Quorum quorum;
	public ImAlive(Quorum q){
		quorum=q;
	}
	
	public void run() {
		quorum.globalImAliveLeader();
		try{Thread.sleep(SEND_INTERVAL);}catch(Exception e){}
		while(true){
			try{Thread.sleep(SEND_INTERVAL);}catch(Exception e){}
			quorum.sendImAlive();
			if(quorum.isLeader()){
				quorum.sendImAliveLeader();
			}
		}
	}
}